package xyz.lne.researchgroupmanage.controller.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import xyz.lne.researchgroupmanage.service.dataTransferObject.FileDTO;

import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;

/**
 * Designed By Lne.
 * 2021/1/22 10:34
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileResponse {
    private Integer fileId;
    private String fileName;
    private Boolean isDir;
//    上传者
    private String userName;
//    上传日期
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;

    public static FileResponse convertFromFileDTO(FileDTO fileDTO){
        if(fileDTO==null)return null;
        FileResponse fileResponse = new FileResponse();
        BeanUtils.copyProperties(fileDTO, fileResponse);
        return fileResponse;
    }
}
